package com.ljb.baseadapter_listview;

import android.content.Context;

import java.util.List;

/**
 * 单一条目类型的Adapter
 * Created by lijianbin on 2016/12/13.
 */
public abstract class CommonAdapter<T> extends MutiItemTypeAdapter<T> {

    public CommonAdapter(Context context, final int layoutId, List<T> datas) {
        super(context, datas);
        addItemViewTemplate(new ItemViewTemplate<T>() {
            @Override
            public int getItemViewLayoutId() {
                return layoutId;
            }

            @Override
            public boolean isForViewType(T item, int position) {
                return true;
            }

            @Override
            public void convert(ViewHolder holder, T item, int position) {
                CommonAdapter.this.convert(holder, item, position);
            }
        });
    }

    /**
     * 数据
     */
    public abstract void convert(ViewHolder holder, T item, int position);
}
